import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AnnualInspectionForm, AnnualInspectionQuery, AnnualInspectionVO } from '@/api/iot/annualInspection/types';

/**
 * 查询电梯年检管理列表
 * @param query
 * @returns {*}
 */

export const listAnnualInspection = (query?: AnnualInspectionQuery): AxiosPromise<AnnualInspectionVO[]> => {
  return request({
    url: '/iot/annualInspection/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询电梯年检管理详细
 * @param inspectionId
 */
export const getAnnualInspection = (inspectionId: string | number): AxiosPromise<AnnualInspectionVO> => {
  return request({
    url: '/iot/annualInspection/' + inspectionId,
    method: 'get'
  });
};

/**
 * 新增电梯年检管理
 * @param data
 */
export const addAnnualInspection = (data: AnnualInspectionForm) => {
  return request({
    url: '/iot/annualInspection',
    method: 'post',
    data: data
  });
};

/**
 * 修改电梯年检管理
 * @param data
 */
export const updateAnnualInspection = (data: AnnualInspectionForm) => {
  return request({
    url: '/iot/annualInspection',
    method: 'put',
    data: data
  });
};

/**
 * 删除电梯年检管理
 * @param inspectionId
 */
export const delAnnualInspection = (inspectionId: string | number | Array<string | number>) => {
  return request({
    url: '/iot/annualInspection/' + inspectionId,
    method: 'delete'
  });
};
